<?php

namespace home\models;

use libs\Utils;
use Yii;
use yii\helpers\Url;

/**
 * This is the model class for table "{{%timeline}}".
 *
 * @property string $id 事记 ID
 * @property string $case_id 案例 ID
 * @property string $name 标题
 * @property string $content 内容
 * @property int $created_at 创建时间
 * @property int $updated_at 修改时间
 * @property int $status 状态
 *
 * @property Cases $case
 */
class Timeline extends \common\models\Timeline
{

    public function getCase()
    {
        return $this->hasOne(Cases::className(), ['id' => 'case_id']);
    }

    public function getViewUrl()
    {
        return Url::to(['timeline/view', 'id' => $this->id]);
    }

    public function showDate()
    {
        return date("Y/m", $this->created_at);
    }

    public function showSummary()
    {
        return strip_tags($this->content);
    }
}
